<template>
  
    <el-header style="  font-size: 12px;height: 100px;">
      <el-header style="text-align: right; font-size: 12px;height: 100px;">
      <h1 style="font-size: 30px; text-align: left;">检验结果管理</h1>
      </el-header>
     </el-header>
       <h3>精准搜索</h3>
            <el-row :gutter="20">
    <el-col :span="4"><div class="grid-content ep-bg-purple" />   
    <el-form-item label="病历号：" prop="orderNo" class="label" >
       <el-input v-model="form.orderNo" placeholder="请输入" />
     </el-form-item>
    </el-col>
    <el-col :span="6"><div class="grid-content ep-bg-purple-light" />
        <el-form-item label="姓名：" prop="patientName"  class="label">
       <el-select v-model="form.patientName" placeholder="请选择">
  
       </el-select>
     </el-form-item>
    </el-col>
   
    <el-col :span="6">
       <el-form-item label="挂号日期："> 
        <div class="block" >
           <el-date-picker
              v-model="form.orderDate"
        type="daterange"
        unlink-panels
        range-separator="To"
        start-placeholder="Start date"
        end-placeholder="End date"
        :shortcuts="shortcuts"
        :size="size"
        style="width: 200px;"
      />
    </div>
       </el-form-item>
    </el-col>
    <el-col :span="4">
        <el-button type="primary" @click="search">查询</el-button>
        <el-button type="primary" @click="resetForm">批量打印</el-button>
    </el-col>
  </el-row>
 
    <el-row>
        
      
 
    </el-row>
    <el-main>
        <el-scrollbar>
            <el-tag type="primary" style="width: 200px; display: flex;justify-content: flex-start;">已选择{{  }}项 <a href="">清空</a></el-tag>
          <el-table :data="tableData">
            <el-table-column type="selection"  />
            <el-table-column type="selection" label="结果编号" />
            <el-table-column value="pName" label="姓名" />
            <el-table-column value="dName" label="项目名称" />
            <el-table-column value="cSatus" label="检查日期" />
            <el-table-column  label="操作" >
                
                <el-button type="primary" @click="lookOrder"> 查看</el-button>
            </el-table-column>
  
          </el-table>
          <div class="demo-pagination-block" style="display: flex; justify-content: space-around; align-items: center;">
    <div class="demonstration">
      <el-button type="primary" @click="handleCounts">批量操作: {{ tableData.length }}条</el-button> 
    </div>
    <el-pagination
      v-model:current-page="currentPage4"
      v-model:page-size="pageSize4"
      :page-sizes="[10, 50, 100, 200]"
      :size="size"
      :disabled="disabled"
      :background="background"
      layout="sizes, prev, pager, next, jumper"
      hide-on-single-page:true
      prev-text="上一页"
      next-text="下一页"
      jump-text="'跳至'"
      :page-count="10"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
     
    />
  </div>
        </el-scrollbar>
      </el-main>
  
  
   </template>
   
   <script lang="ts" setup name="Order">
  import axiosInstance from '@/utils/axiosUtils';
  import { ref } from 'vue';
  import { reactive, toRefs } from 'vue'
   import type { ComponentSize } from 'element-plus'
  const currentPage4 = ref(1)
  const pageSize4 = ref(10)
  const size = ref<ComponentSize>('default')
  const background = ref(true)
  const disabled = ref(false)
  
  const handleSizeChange = (val: number) => {
    console.log(`${val} items per page`)
  }
  const handleCurrentChange = (val: number) => {
    console.log(`current page: ${val}`)
  }
  const handleCounts = () => {
    console.log('批量操作')
  }
  const shortcuts = [
  {
    text: 'Last week',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
      return [start, end]
    },
  },
  {
    text: 'Last month',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
      return [start, end]
    },
  },
  {
    text: 'Last 3 months',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
      return [start, end]
    },
  },
  ]
  const tableData =reactive( [{
    
  }
  ])
  const form = reactive({
   orderNo:'',
   patientName:'',
   birthday:'',
   fangStatus:1,
   fangName:null,
   checkStatus:1,
   deptName:null,
   orderDate:null,
   pageNum:1,
   pageSize:10,
   total:0,
  
  });
  //清空表单函数
  const resetForm=()=>{
  for(const key in form){
    form[key]='';
  }
  };
  const search=()=>{
  };
  const select=()=>{
  };
  const lookOrder=()=>{
    
  
  };
  const deleteOrder=()=>{
    
  };
  axiosInstance.get("/api/register/getOrderNo?id="+1).then(
  response=>{
    console.log('success'+response.data);
    form.orderNo=response.data;
  }
  ).catch(error=>{
  console.log('error');
  })
  
  
  </script>
  
  
  
  
  
  
  <style lang="css" link-ref="main.css"/>
  <style scoped> 
  h1{
    padding-left: 30px;
    
  }
  .label{
  width: 200px;
   color: grey;
  padding-left: 30px;
  
  }
   
  h3{
  padding-left: 20px;
  }
  .demo-basic {
  text-align: right;
  }
  .demo-basic .sub-title {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--el-text-color-secondary);
  }
  .demo-basic .demo-basic--circle,
  .demo-basic .demo-basic--square {
  display: flex;
  justify-content: flex-end;
  align-items: right;
  }
  .demo-basic .block:not(:last-child) {
  border-right: 1px solid var(--el-border-color);
  }
  .demo-basic .block {
  flex: 1;
  }
  .demo-basic .el-col:not(:last-child) {
  border-right: 1px solid var(--el-border-color);
  }
  
  
  </style>